<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ShopAdminRoleNodes extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
      Schema::create('shop_admin_node_roles', function (Blueprint $table) {
        $table->integer('node_id')->unsigned();
        $table->integer('role_id')->unsigned();

        $table->foreign('node_id')
            ->references('id')->on('shop_admin_nodes')
            ->onUpdate('cascade')->onDelete('cascade');
        $table->foreign('role_id')
            ->references('id')->on('shop_admin_roles')
            ->onUpdate('cascade')->onDelete('cascade');
      });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
      Schema::dropIfExists('shop_admin_node_roles');
    }
}
